import cv2
import numpy as np


def test1():
    #
    data = np.loadtxt('exam_ans_cell_202405281701.csv', delimiter=',', dtype=str, encoding='utf-8', skiprows=1)
    #
    img = cv2.imread('sheet.png')

    for i, row in enumerate(data):
        top_x, top_y, bottom_x, bottom_y = int(row[4]), int(row[5]), int(row[6]), int(row[7])
        #
        copy = img[top_y:bottom_y, top_x:bottom_x]

        #
        cv2.imwrite("testttt-{}.png".format(i + 1), copy)
